from PyQt5.QtCore import pyqtSlot,pyqtProperty, pyqtSignal, QPointF, QUrl
from PyQt5.QtGui import QColor, QGuiApplication
from PyQt5.QtQml import qmlRegisterType
from PyQt5.QtQuick import (QQuickItem, QQuickView, QSGFlatColorMaterial,
        QSGGeometry, QSGGeometryNode, QSGNode)
from PyQt5.QtWidgets import QApplication,QFileDialog
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QSettings
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5 import QtWidgets
import sys
import platform
import os
import config_json
from pathlib import Path
import traceback
import logging
import csonh
from logging.handlers import RotatingFileHandler
sys.stdout = open(sys.stdout.fileno(), mode='w', encoding='utf8', buffering=1)
sys.stderr = open(sys.stderr.fileno(), mode='w', encoding='utf8', buffering=1)
handlers=[RotatingFileHandler(filename="report.log", maxBytes=10*1024*1024, encoding='utf-8',backupCount=3),logging.StreamHandler(sys.stdout)]
logging.basicConfig(level=logging.DEBUG,
                    format = '%(asctime)s - %(name)s - %(levelname)s -%(funcName)s - %(message)s',
                    handlers=handlers)
logging.info('begin')
def main():
    from mainw import MainW
    a=QtWidgets.QApplication([''])
    a.setQuitOnLastWindowClosed(True)
    m=MainW()
    m.resize(1200,800)
    m.show()
    r=a.exec()
    sys.exit(r)
if __name__=="__main__":
    main()
    #testlink()
